<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<script type="text/javascript">
function editNodeText(regex, input, helpId, helpMessage)
{
	
	
	}
function ValidateForm(){
	if(document.RegForm.UserName.value==""){
		alert("Please Enter Your User Name");
		return false;
	}

	if(document.RegForm.Password.value==""){
		alert("Please Enter Your Password");
		document.RegForm.Password.focus();
		return false;
	}
	
	if(document.RegForm.Email.value==""){
		alert("Please Enter Your Email");
		return false;
	}
	var x=document.forms["RegForm"]["Email"].value;
	var atpos=x.indexOf("@");
	var dotpos=x.lastIndexOf(".");
	if (atpos<1 || dotpos<atpos+2 || dotpos+2>=x.length)
	  {
	  alert("Not a valid e-mail address");
	  return false;
	  }
	if(document.RegForm.country.value=="0"){
		alert("Select your country");
		return false;
	}

	else{
		return true;
	}
}


</script>

<body>
	<center>
		<h1>Java Script form validation</h1>
	</center>
	<form name="RegForm" action="Proccess.php" method="post"
		onsubmit="return ValidateForm()">
		<table width="600" border="1" align="center">
			<tr>
				<td width="200" height="40">User Name:</td>
				<td width="400">&nbsp; <input type="text" name="UserName" />
				</td>
			</tr>
			<tr>
				<td width="200" height="40">Password:</td>
				<td width="400">&nbsp; <input type="text" name="Password" />
				</td>
			</tr>
			<tr>
				<td width="200" height="40">Email ID :</td>
				<td width="400">&nbsp; <input type="text" name="Email" />
				</td>
			</tr>
			<tr>
				<td width="200" height="40">Country :</td>
				<td width="400">&nbsp; <select name="country">
						<option value="0">Please Select</option>
						<option value="IND">India</option>
						<option value="USA">U.S.A</option>
				</select>
				</td>
			</tr>
			<tr>
				<td width="200">&nbsp;</td>
				<td height="50">&nbsp; <input type="submit" value="submit" />
				</td>
			</tr>
		</table>

	</form>

</body>
</html>
